package br.com.biblioteca.dao;

import br.com.biblioteca.exceptions.ConflictExcetion;
import br.com.biblioteca.exceptions.NotFoundException;
import java.io.Serializable;
import java.util.List;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.ProjectionList;

/**
 *
 * @author João Sávio Ceregatti Longo - joaosavio@gmail.com
 */
public interface IGenericDAO<T, ID extends Serializable> {
    void add(T t) throws ConflictExcetion ;
    void update(T t) throws NotFoundException;
    void delete(T t) throws NotFoundException;
    T getById(ID id) throws NotFoundException;
    List<T> listAll();
    List<T> list(int begin, int length);
    List<T> findByCriteria(List<Criterion> list, ProjectionList projectionList);
    List<T> findByExample(T exampleInstance, List<String> excludeProperty);
    Long count();
    Long count(String column, String where);
    Double sum(String column);
    Double sum(String column, String where);
    Double avg(String column);
    Double avg(String column, String where);
    void add(List<T> list);
    void deleteAll();
    List hqlQuery(String hql) throws Exception;
    List sqlQuery(String sql) throws Exception;
}
